﻿<%@ Page Title="Add Student" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminMaster.master"
    Inherits="System.Web.Mvc.ViewPage<Eacademy.Domain.Models.AdminLessonsViewModel>" %>

<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
    <script src="/content/js/jquery.tokeninput.js" type="text/javascript"></script>
    <link href="/content/css/token-input.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(document).ready(function () {

            $('#Lesson').tinymce(tinyMCEsettings);
            var auth = "<% = Request.Cookies[FormsAuthentication.FormsCookieName]==null ? string.Empty : Request.Cookies[FormsAuthentication.FormsCookieName].Value %>";
            var ss = "<%= Session.SessionID %>;"
            $("#multipleFiles").uploadify({
                uploader: "/content/uploadify.swf",
                script: '<%= Url.Action("Upload") %>',
                buttonText: 'Attach Files',
                multi: true,
                fileDataName: 'file',
                sizeLimit: 1048576,
                removeCompleted: false,
                fileDesc: 'Document (*.doc;*.docx;*.txt;*.ppt;*.pdf;*.jpg;*.jpeg;*.png;*.gif)',
                fileExt: '*.doc;*.docx;*.txt;*.ppt;*.pdf;*.jpg;*.jpeg;*.png;*.gif',
                scriptData: { authtoken: auth, si: ss },
                simUploadLimit: 5,
                cancelImg: '/content/images/cancel.png',
                auto: true,
                onError: function (a, b, c, d) {
                    //alert("Error: "+d.type+" Info: "+d.info);
                },
                onComplete: function (event, queueId, fileObj, response, data) {
                    //alert(response.responseText);
                }
            });
            $("#subbtn").click(function () {
                var arr = [];
                arr = $.map($("#multipleFilesQueue .fileName"), function (n, i) {
                    var st = $(n).html();
                    return st.substring(0, st.lastIndexOf(' '));
                });
                $("input[name='filenames']").val(arr.join(","));
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Add Lesson
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h3>
        Add Lesson</h3>
    <% using (Html.BeginForm("Add", "Lessons", FormMethod.Post, new { autocomplete = "off" }))
       {%>
    <div class="forms-elements">
        <div class="form-wrapper">
            <div class="form-label">
                <%: Html.LabelFor(model => model.Title)%>
            </div>
            <div class="form-element">
                <div class="textbox-xmedium-form">
                    <%: Html.TextBoxFor(model => model.Title, new { @class = "textbox-xmedium-field" })%>
                </div>
            </div>
            <div class="form-error form-error-150">
                <%: Html.ValidationMessageFor(model => model.Title)%>
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
                <%: Html.LabelFor(model => model.Lesson)%>
            </div>
            <div class="form-element description">
                <%: Html.TextAreaFor(model => model.Lesson)%>
            </div>
            <div class="form-error">
                <%: Html.ValidationMessageFor(model => model.Lesson)%>
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
            </div>
            <div class="form-element">
                <input type="file" id="multipleFiles" />
                <input type="hidden" name="filenames" />
            </div>
        </div>
        <div class="form-wrapper">
            <div class="form-label">
            </div>
            <div class="form-element">
                <%: Html.HiddenFor(model => model.SubjectId) %>
                <%: Html.HiddenFor(model => model.MentorUserId) %>
                <input type="submit" value="Add Lesson" class="button-style" />
            </div>
        </div>
    </div>
    <% } %>
</asp:Content>
